<template>
  <div>
    <el-form :model="cform">
      <el-form-item label="房间号" :label-width="formLabelWidth">
        <el-input v-model="cform.id" autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item label="姓名" :label-width="formLabelWidth">
        <el-input v-model="cform.name" autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item label="手机号" :label-width="formLabelWidth">
        <el-input v-model="cform.phone" autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item label="身份证 " :label-width="formLabelWidth">
        <el-input v-model="cform.cardId" autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item label="时间" :label-width="formLabelWidth">
        <div class="block">
          <el-date-picker
            v-model="cform.date"
            type="datetimerange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            align="right"
          >
          </el-date-picker>
        </div>
      </el-form-item>
      <el-form-item label="押金" :label-width="formLabelWidth">
        <el-input v-model="cform.deposit" autocomplete="off"></el-input>
      </el-form-item>

      <el-button type="primary" @click="sbutton">确 定</el-button>
    </el-form>
    <!-- <h1>传参--{{ $route.query.id }}</h1> -->
    <!-- <el-button @click="a">asdfadf</el-button> -->
  </div>
</template>
<script>
  export default {
    name: "search",
    data() {
      return {
        formLabelWidth: "120px",
        cform: {},

        value: "",

        value2: "",
      };
    },
    methods: {
      a() {
        console.log(this.value2);
      },
      async sbutton() {
        console.log(this.cform)
        let result = await this.$API.room.reqaddTable(this.cform);
        console.log(result)
        if (result.code === 20000) {
          this.$message({
            message: '办理完毕',
            type: 'success',
            duration: 800,
          })
          this.cform = {};
        }
      },
    },
  };
</script>
<style scoped>
  .div-style {
    display: flex;
  }
</style>
